package com.pzhu.gmall.manage.controller;

import java.util.List;

import com.pzhu.gmall.bean.PmsBaseCatalog1;
import com.pzhu.gmall.bean.PmsBaseCatalog2;
import com.pzhu.gmall.bean.PmsBaseCatalog3;
import com.pzhu.gmall.service.CatalogService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘鹏 liupeng
 * @date 2019/10/30
 **/
@RestController
@CrossOrigin
public class CatalogController {

    @Reference
    private CatalogService catalogService;

    @GetMapping("/catalog1")
    public List<PmsBaseCatalog1> getPmsBaseCatalog1List() {
        return catalogService.getAllCatalog1();
    }

    @GetMapping("/catalog2")
    public List<PmsBaseCatalog2> getPmsBaseCatalog2List(String catalog1Id) {
        return catalogService.getCataLog2ByCataLog1Id(catalog1Id);
    }
    @GetMapping("/catalog3")
    public List<PmsBaseCatalog3> getPmsBaseCatalog3List(String catalog2Id) {
        return catalogService.getCataLog3ByCataLog2Id(catalog2Id);
    }
}
